'use strict';
let even_group_calculate_average = function(collection){
    var isEven=i=>i%2===0;
    var indexEvens=arr=>arr.filter((value,index)=>isEven(index+1))
    var getEvenArray=arr=>arr.filter(item=>item%2==0)
    var getAllEvents=arr=>{
        let temp=indexEvens(arr);
        return getEvenArray(temp);
    }
    let evenArray=getAllEvents(collection);
    var groupThree=evenArray.filter(i=>i>100)
    var groupTwo=evenArray.filter(i=>(i<100&&i>10))
    var groupOne=evenArray.filter(i=>i<10)
    var average=arr=>(arr.reduce((pre,cur)=>{
        return pre+cur
    },0)/arr.length)
    let result=[];
    if(evenArray==false){
        result=[0]
    }else{
        if((groupOne==false)&&(groupTwo==false)&&groupThree){
            result.push(average(groupThree));
        }else{
            result.push(average(groupOne));
            result.push(average(groupTwo));
            result.push(average(groupThree));
        }
    }
    return result;
};
module.exports = even_group_calculate_average;
